<?php

namespace app\api\controller;

use app\common\controller\Api;
use EasyWeChat\Factory;


/**
 * 首页接口
 */
class Index extends Api
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
	/**
     * 公共
	 * @author gzy
	 * @date   2018年8月12日 10:15:00
     */
	public function _initialize(){
        parent::_initialize();
		//获取默认值
		$this->config = $this->getConfig($this->getDefault('Work'));
	}
    /**
     * 首页
     * 
     */
    public function index()
    {	
		print_R(__('Position'));die;
		//include APP_PATH. 'admin/common.php';
		var_dump(AdminAuth('finance/extract/week/see_dept'));die;
			print_r(TableField('Position','id','外联','name','admin/base'));die;
		$a = '网购部';
		$a = explode(',',$a);
		print_R($a);die;
		$a = TableField('AuthGroup','name',13,'id','admin');
		print_R($a);die;
        $this->success('请求成功');
    }

    /**
     * 获取全部部门
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     */
    public function work() {
        $app = Factory::work($this->config);
        $contacts = $app->department->list();//获取部门列表
        //$userAll = $app->user->getDetailedDepartmentUsers(7); 获取某个部门的人员
        $this->success('全部部门', ['contacts' => $contacts]);
    }


}
